package com.zhuiyun.educations.api.uploadFile.service;

import com.zhuiyun.educations.api.uploadFile.entity.FileManage;
import com.zhuiyun.educations.common.errorCode.CommonException;
import com.zhuiyun.educations.common.response.CommonResult;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;
import java.io.FileNotFoundException;


public interface FileManageService  {

    /**
     * 通过id删除图片 和 数据中的记录
     * @param id
     * @return
     * @throws CommonException
     */
    CommonResult deleteImageById(Integer id) throws CommonException;


    /**
     * 将前台接收的图片保存到系统并记录文件信息
     *
     * @param file
     * @param projectName
     * @return
     * @throws CommonException
     */
    FileManage saveFileToSystem(MultipartFile file, String projectName) throws CommonException;


    /**
     * 下载图片
     * @param response
     * @param id
     */
    void getImage(HttpServletResponse response, Integer id) throws CommonException;

    void getImageByUrl(HttpServletResponse response, String url);

    void getFileById(HttpServletResponse response, Integer id) throws CommonException;

    void getVideoById(HttpServletResponse response, Integer id) throws CommonException, FileNotFoundException;
    /**
     * @Author ys
     * @Description TODO 修改
     * @Date 2023/6/26 14:09
     * @Return CommonResult
     * @param
     */
    CommonResult updateCourseFile(FileManage fileManage);
}
